<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        window.onload = function(){
            //1.查询body标签
            // var body = document.body;
            // console.log(body);
            // var body2 = document.getElementsByTagName('body')[0];
            // console.log(body2);

            //查询html根标签
            // var html = document.documentElement;
            // console.log(html);
            // var html2 = document.getElementsByTagName('html')[0];
            // console.log(html2);

            //获取所有元素
            // var all = document.all;
            // console.log(all);

            //根据元素的class属性值查询一组元素节点对象
            // var box = document.getElementsByClassName('box1');
            // console.log(box.length);

            //querySelect
            var div = document.querySelector('.box1 p');
            console.log(div);
            var divall = document.querySelectorAll('.box1 p');
            console.log(divall);
        }
        
       
    </script>
</head>
<body>
    <div class="box1">
        <p>
        </p>
        <p>
        </p>
    </div>
    <div class="box1">
        <p>
        </p>
    </div>
    <div class="box1">
        <p>
        </p>
    </div>
</body>
</html>